<template>
	<view class="body">
		<view class="dizhi" v-for="(item,index) in list" :key="index">
			<view class="jia">
				{{item.tag}}
			</view>
			<view class="name">
				{{item.name}}
			</view>
			<view class="city">
				{{item.cityStr}}
			</view>
			
			<view class="tel">
				{{item.tel}}
			</view>
			
			<view class="bianji" @tap="bianji(item.id)">
				编辑
			</view>
		</view>
	</view>
</template>

<script>
	import {address} from "../../../util/user/address.js"
	export default {
		data() {
			return {
				list:[]
			};
			
			
		},
		methods:{
			// onBackPress(event){
			// 	console.log(event)
			// 	uni.navigateTo({
			// 		url:`./user/user`
			// 	})
			// },
			bianji(val){
				uni.navigateTo({
					url:`./bianji/bianji?id=${val}`
				})
			}
		},
	async onLoad() {
				uni.setNavigationBarTitle({
					title: '地址',
				
				});
				uni.setNavigationBarColor({
				
					frontColor: '#ffffff',
					backgroundColor: ' #354E44',
					animation: {
						duration: 400,
						timingFunc: 'easeIn'
					}
				})
				
				var res  =await address({
					userId:'52aeb3ea2a1f437399fac5e5391a4b2e'
				})
				console.log(res)
				this.list=res.data.data
		},
		onShow() {
			
		}
	}
</script>

<style lang="scss" scoped>
	.body {
		background-color: #F1ECE7;
		width: 100%;
		height: 100%;
		overflow: hidden;
	}
	
	.dizhi{
		position: relative;
		display: flex;
		width: 80%;
		height: 200rpx;
		background-color: #FFFFFF;
		margin: 0 auto;
		margin-top: 100rpx;
		border-radius: 20rpx;
		
		.jia{
			width: 80rpx;
			height: 80rpx;
			color: #FFFFFF;
			font-weight: bold;
			border-radius: 50%;
			background-color:#354E44;
			text-align: center;
			line-height: 80rpx;
			margin-top: 50rpx;
			margin-left: 30rpx;
		}
		
		.name{
			height: 37rpx;
			font-size: 26rpx;
			color: #3E3E3E;
			font-weight: bold;
			margin-left: 26rpx;
			margin-top: 30rpx;
		}
		
			
		.city{
			position: absolute;
			font-size: 22rpx;
			color: #8D8D8D;
			height: 30rpx;
			top: 70rpx;
			left: 130rpx;
		}
			.tel{
				position: absolute;
					font-size: 22rpx;
					color: #8D8D8D;
					height: 30rpx;
					top: 110rpx;
					left: 133rpx;
				}
				
				.bianji{
					position: absolute;
					font-size: 26rpx;
					color: #8D8D8D;
					top: 80rpx;
					right: 30rpx;
					padding: 10rpx;
					border-left: 2rpx solid #8D8D8D;
				}
	}
</style>
